package com.tgpms.web.earlierStage.dao;

import com.tgpms.web.earlierStage.entity.DocUploadEntityHistory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 文档版本信息表 Mapper 接口
 * </p>
 *
 * @author newway
 * @since 2020-04-07
 */
 @Mapper
public interface DocUploadEntityHistoryMapper extends BaseMapper<DocUploadEntityHistory>{

	 //根据文档id删除版本信息
	 @Delete("delete from DOC_UPLOAD_ENTITY_HISTORY where DOC_ID=#{docId}")
	 Integer deleteEntityHistoryByDocId(@Param("docId")String docId);
	 
	 //根据文档id查询最大版本号
	 @Select("select MAX(DOC_VERSION) from DOC_UPLOAD_ENTITY_HISTORY where DOC_ID=#{docId}")
	 Integer getMaxVersionByDocId(@Param("docId")String docId);
}
